import { param } from './../../../utils/index';
import { dataQuery, dataVO, taskDataVO, taskDataQuery, resultDataVO, resultDataQuery } from './type';
import request from '@/utils/request';
import { AxiosPromise } from 'axios';
// 查询【载荷实验】列表
export const getExperimentList = (query): AxiosPromise<dataVO[]> => {
  return request({
    url: '/business/loadExperiment/list',
    method: 'get',
    params: query
  });
};
// 删除【载荷实验】
export const deleteExperiment = (ids: string | number) => {
  return request({
    url: '/business/loadExperiment/' + ids,
    method: 'delete'
  });
};
//新增【载荷实验】
export const addExperiment = (data) => {
  return request({
    url: '/business/loadExperiment',
    method: 'post',
    data
  });
};
//修改【载荷实验】
export const editExperiment = (data) => {
  return request({
    url: '/business/loadExperiment',
    method: 'put',
    data
  });
};
//自定义【载荷实验】文件
export const uploadCustomization = (data) => {
  return request({
    url: '/business/loadExperiment/uploadCustomizationFile',
    method: 'post',
    data
  });
};
//获取【载荷实验】详情
export const getExperimentDetail = (id: string | number) => {
  return request({
    url: `/business/loadExperiment/${id}`,
    method: 'get'
  });
};
//开始任务
export const startTask = (data) => {
  return request({
    url: '/business/taskInfo/startTask',
    method: 'post',
    data
  });
};
// 查询【实验中任务】列表
export const getTaskInfoList = (query: taskDataQuery): AxiosPromise<taskDataVO[]> => {
  return request({
    url: '/business/taskInfo/list',
    method: 'get',
    params: query
  });
};

// 查询【实验中任务】列表
export const getTaskInfo = (id: string | number) => {
  return request({
    url: `/business/taskInfo/${id}`,
    method: 'get'
  });
};
export const geTaskResultList = (data) => {
  return request({
    url: '/isfd/taskResult/list',
    method: 'post',
    data
  });
};
export const queryFileList = (data) => {
  return request({
    url: '/isfd/taskResult/queryFileList',
    method: 'post',
    data
  });
};
export const downloadFiles = (data) => {
  return request({
    url: '/isfd/taskResult/downloadFiles',
    method: 'post',
    data,
    responseType: 'blob'
  });
};
// 下载程序
export const downloadProgram = (data) => {
  return request({
    url: '/isfd/taskResult/downloadProgram',
    method: 'post',
    data,
    responseType: 'blob'
  });
};
//上传载荷试验文件
export const uploadLoadExperiment = (data) => {
  return request({
    url: `/business/loadExperiment/upload`,
    method: 'post',
    data
  });
};
// 删除【载荷实验】
export const deleteTaskResult = (data) => {
  return request({
    url: '/isfd/taskResult/delete',
    method: 'post',
    data
  });
};
//历史数据新增【载荷实验】
export const addByHistory = (data) => {
  return request({
    url: '/business/loadExperiment/addByHistory',
    method: 'post',
    data
  });
};
// 查询【载荷日志】列表
export const taskLogList = (params) => {
  return request({
    url: '/business/taskLog/list',
    method: 'get',
    params
  });
};
// 查询【算法】列表
export const asapGetAnalysisList = (data) => {
  return request({
    url: '/business/taskInfo/asapGetAnalysisList',
    method: 'post',
    data: JSON.stringify(data)
  });
};
// 创建分析
export const asapCreateAnalysisLoad = (data) => {
  return request({
    url: '/business/taskInfo/asapCreateAnalysisLoad',
    method: 'post',
    data
  });
};
// 查询任务算法
export const asapGetTreeDataByAnalysis = (data) => {
  return request({
    url: '/business/taskInfo/asapGetTreeDataByAnalysis',
    method: 'post',
    data
  });
};
// 查询任务算法参数
export const asapGetParameterConfigPath = (data) => {
  return request({
    url: '/business/taskInfo/asapGetParameterConfigPath',
    method: 'post',
    data
  });
};
// 查询任务算法参数详情
export const asapGetParameter = (data) => {
  return request({
    url: '/business/taskInfo/asapGetParameter',
    method: 'post',
    data
  });
};
// 开始任务
export const asapDoCalculateLoad = (data) => {
  return request({
    url: '/business/taskInfo/asapDoCalculateLoad',
    method: 'post',
    data
  });
};